package com.atguigu.system.controller;


import com.atguigu.common.result.Result;
import com.atguigu.model.dto.SysCheckWorkDTO;
import com.atguigu.model.system.SysCheckWork;
import com.atguigu.model.system.SysUser;
import com.atguigu.model.vo.SysCheckWorkVo;
import com.atguigu.system.annotation.Log;
import com.atguigu.system.enums.BusinessType;
import com.atguigu.system.service.SysCheckWorkService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考勤表 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2024-06-19
 */
@Api(tags = "考勤管理")
@RestController
@RequestMapping("/admin/system/sys-check-work")
public class SysCheckWorkController {

    @Resource
    private SysCheckWorkService service;

    @ApiOperation("自动生成某些人某月考勤报表")
    @Log(title = "自动生成某些人某月考勤报表",businessType = BusinessType.INSERT)
    @PostMapping("/autoCheckWork")
    public Result autoCheckWork(@RequestBody SysCheckWorkVo vo) {
        service.autoCheckWork(vo);
        return Result.ok();
    }

    @ApiOperation("获取某些人某月考勤报表")
    @GetMapping("/getCheckWorkList/{page}/{limit}")
    public Result getCheckWorkList(@PathVariable Long page,
                                   @PathVariable Long limit,SysCheckWorkVo vo) {
        //创建page对象
        Page<SysCheckWork> pageParam = new Page<>(page,limit);
        //调用service方法
        IPage<SysCheckWork> pageModel = service.selectPage(pageParam,vo);
        return Result.ok(pageModel);
    }
}

